//  Omnima Limited Copyright (c) 2011
//
//  Targets STM32L and STM32F family MCUs as used 
//  on the omnima-stm32-expander board
//
//  STM32L-Discovery GCC Demo program
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

#include <stdarg.h>

//---------


#ifndef SPRINTFH
#define SPRINTFH


#include "platform.h"


//Function to output chars, returns 1 to continue, 0 to stop
typedef int (*funcPutChar)(char ch, ULONG ud);


//Streams string pointed by pStr to fPutChar
int f_puts(funcPutChar fPutChar, const char *pStr, ULONG ud);


//Streams bytes stored in pBuf to the length of len
int f_putb(funcPutChar fPutByte, const unsigned char *pBuf, ULONG len, ULONG ud);


#define NOTEOFPRINTF -1
#define EOFPRINTF 0

int funcprintfArp (
	funcPutChar fPutChar,
	ULONG ud,
	const char* str,	// Pointer to the format string
	va_list arp		    // Optional arguments...
);

int funcprintf (
	funcPutChar fPutChar,
	ULONG ud,
	const char* str,	// Pointer to the format string
	...					// Optional arguments... 
);


typedef struct 
{
	char *pBuf;
	UINT32 bufSize;
	UINT32 pos;
} printToStringType;

int osprintf(char* strBuf, UINT32 bufSize, const char*format, ...);

#endif
